<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 86153
  Date: 2023/2/27
  Time: 10:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
%>


<html>
<head>
	<base href="<%=basePath%>">
	<link href="css/haiersoft.css" rel="stylesheet" type="text/css" media="screen,print"/>
	<link href="css/print.css" rel="stylesheet" type="text/css" media="print"/>
	<link href="css/css.css" rel="stylesheet" type="text/css" media="print"/>
	<script src="js/jquery-1.10.1.min.js"></script>
	<script src="js/side.js" type="text/javascript"></script>
	<script src="js/jquery-3.6.0.js"></script>
	<script>
        function Update_Soldier(e) {
            var formObject = {};
            var formArray = $("#form1").serializeArray();
            $.each(formArray, function (i, item) {
                formObject[item.name] = item.value;
            });
            $.ajax({
                url: 'soldier_info/Update_info',
                headers: {
                    'Content-Type': 'application/json;charset=utf-8',
                },
                type: 'POST',
                data: JSON.stringify(formObject),
                dataType: "json",
                success: function (data) {
                    if (data.code == '0000') {
                        console.log(data.message);
                        alert("修改失败");
                    } else if (data.code == '0001') {
                        console.log(data.message);
                        alert("修改成功");
                        window.location.reload();
                    }else if (data.code == '0002') {
                        window.location.href='jsp/soldier.jsp?mobile='+data.data;
                    }
                }
            })
        }
	</script>
</head>
<body>
<form id="form1">
	<div id="Popup">
		<div id="SubPopup">
			<div class="form_boxC">
				<p>"<span class="f_cB">*</span>"号为不可修改项目</p>
				<table cellpadding="0" cellspacing="0">
					<tr>
						<th width="100">姓名 <span class="f_cB"></span></th>
						<td>
							<div class="txtbox floatL" style="width:100px;">
								<input name="soldierName" type="text" size="5" value=${soldierInfo.soldierName}>
							</div>
						</td>
					</tr>
					<tr>
						<th width="100">年龄 <span class="f_cB"></span></th>
						<td>
							<div class="txtbox floatL" style="width:100px;">
								<input name="soldierAge" type="text" size="5" value=${soldierInfo.soldierAge}>
							</div>
						</td>
					</tr>
					<tr>
						<th width="100">籍贯 <span class="f_cB"></span></th>
						<td>
							<div class="txtbox floatL" style="width:230px;">
								<input name="soldierOrigin" type="text" size="20" value=${soldierInfo.soldierOrigin}>
							</div>
						</td>
					</tr>
					<tr>
						<th width="100">现住址 <span class="f_cB"></span></th>
						<td>
							<div class="txtbox floatL" style="width:230px;">
								<input name="homeLocal" type="text" size="20" value=${soldierInfo.homeLocal}>
							</div>
						</td>
					</tr>
					<tr>
						<th width="100">服役时间 <span class="f_cB"></span></th>
						<td>
							<div class="txtbox floatL" style="width:200px;">
								<input name="serviceTime" type="date" size="10" value=${soldierInfo.serviceTime}>
							</div>
						</td>
					</tr>
					<tr>
						<th width="100">退役时间 <span class="f_cB"></span></th>
						<td>
							<div class="txtbox floatL" style="width:200px;">
								<input name="decommissioningTime" type="date" size="10" value=${soldierInfo.decommissioningTime}>
							</div>
						</td>
					</tr>
					<tr>
						<th width="100">工作状态 <span class="f_cB"></span></th>
						<td>
							<div class="txtbox floatL" style="width:200px;">
								<input name="psStatus" type="text" size="10" value=${soldierInfo.psStatus} placeholder="未就业/已就业">
							</div>
						</td>
					</tr>
					<tr>
						<th width="100">手机号 <span class="f_cB">*</span></th>
						<td>
							<div class="txtbox floatL" style="width:150px;">
								<input name="mobile" type="text" size="9" value=${soldierInfo.mobile} readonly>
							</div>
						</td>
					</tr>
				</table>
			</div>
			<div id="BtmBtn">
				<div class="btn_boxB floatR mag_l20">
					<span style="cursor: pointer;background-color: #36c4aa;color: white;padding: 12px 20px;display: inline-block;font-size: 15px;" onclick="Update_Soldier()"><input type="hidden" />确定</span>
				</div>
				<div class="btn_box floatR">
					<button style="cursor: pointer;background-color: #4CAF50;color: white;padding: 12px 20px;display: inline-block;font-size: 15px;"><a style="color: white; text-decoration:none;" href="jsp/soldier.jsp?mobile=${soldierInfo.mobile}">返回</a></button>
				</div>
			</div>
		</div>
	</div>
</form>

</body>
</html>
